/* 文件预览样式 - 高性能优化 */

.file-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.file-preview-container {
    display: flex;
    flex-direction: column;
    width: 90vw;
    height: 90vh;
    max-width: 1200px;
    max-height: 800px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.preview-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    flex: 1;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    margin-right: 16px;
}

.preview-controls {
    display: flex;
    gap: 8px;
}

.preview-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
}

/* 图片预览样式 */
.image-preview-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    user-select: none;
}

.image-wrapper img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    will-change: transform;
}

.image-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid #dee2e6;
    flex-shrink: 0;
}

.zoom-info {
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

/* 视频预览样式 */
.video-preview-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.video-preview-container video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* 音频预览样式 */
.audio-preview-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 30px;
}

.audio-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #666;
}

.audio-icon {
    font-size: 64px;
    color: #409EFF;
}

.audio-name {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    max-width: 400px;
    word-break: break-all;
}

.audio-preview-container audio {
    width: 100%;
    max-width: 500px;
    height: 54px;
    border-radius: 27px;
    background: #f0f0f0;
}

/* 不支持的文件类型样式 */
.unsupported-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: #999;
    padding: 40px;
}

.unsupported-icon {
    font-size: 64px;
    color: #ccc;
}

.unsupported-text {
    font-size: 16px;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .file-preview-container {
        width: 95vw;
        height: 95vh;
        max-width: none;
        max-height: none;
    }
    
    .preview-header {
        padding: 12px 16px;
    }
    
    .preview-title {
        font-size: 14px;
    }
    
    .image-controls {
        padding: 12px;
        gap: 8px;
    }
    
    .image-controls .el-button {
        padding: 8px;
    }
    
    .zoom-info {
        font-size: 12px;
        min-width: 40px;
    }
    
    .audio-info {
        gap: 12px;
    }
    
    .audio-icon {
        font-size: 48px;
    }
    
    .audio-name {
        font-size: 16px;
    }
}

/* 全屏模式优化 */
.file-preview-container:fullscreen {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
}

.file-preview-container:fullscreen .preview-content {
    background: #000;
}

/* 高性能优化 */
.image-wrapper img {
    /* 开启硬件加速 */
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* 滚动条样式优化 */
.preview-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.preview-content::-webkit-scrollbar-track {
    background: transparent;
}

.preview-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.preview-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* 按钮样式优化 */
.preview-controls .el-button,
.image-controls .el-button {
    transition: all 0.2s ease;
}

.preview-controls .el-button:hover,
.image-controls .el-button:hover {
    transform: scale(1.05);
}

/* 加载状态 */
.image-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #999;
    font-size: 16px;
}

/* 错误状态 */
.preview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: #e74c3c;
    padding: 40px;
}

.preview-error-icon {
    font-size: 48px;
}

.preview-error-text {
    font-size: 16px;
    text-align: center;
}